import 'package:flutter/material.dart';
import 'package:flutter_syt/domain/widgets/network_load_image.dart';
import 'package:flutter_syt/utils/global_date_time_format.dart';

import 'flow_item.dart';

class CellItem extends StatelessWidget {
  final FlowItemEntity entity;

  const CellItem(this.entity, {Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 176,
      // decoration: BoxDecoration(
      //   borderRadius: BorderRadius.circular(16),
      //   color: Colors.white,
      //   boxShadow: [
      //     BoxShadow(
      //       color: const Color(0xFFCDCDCD),
      //       offset: Offset(0, 2),
      //       blurRadius: 5,
      //     ),
      //   ],
      // ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        mainAxisSize: MainAxisSize.min,
        children: [
          Container(
            child: ClipRRect(
              borderRadius: BorderRadius.circular(12),
              child:
                  //  CachedNetworkImage(
                  // "https://via.placeholder.com/176/0000FF.png",
                  // imageUrl:
                  NetworkLoadImage.loadNetworkImage(
                entity.imageUrl,
                fit: BoxFit.cover,
                width: 176,
                height: 132,
              ),
            ),
          ),
          Container(
            padding: EdgeInsets.only(top: 14),
            width: 176,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  entity.text,
                  maxLines: 2,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(
                      fontSize: 14, color: Colors.black.withOpacity(0.8)),
                ),
                SizedBox(
                  height: 10,
                ),
                Text(
                  formatDate(entity.createTime),
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(
                      fontSize: 11, color: Colors.black.withOpacity(0.4)),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
